<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <script src="./index.js"></script>
    <script>
      const promise1 = new MyPromise((resolve, reject) => {
        setTimeout(() => {
          reject('error1')
        }, 2000);
      });
      const promise2 = new MyPromise((resolve, reject) => {
        setTimeout(() => {
          reject('error2')
        }, 3000);
      });
      const promise3 = new MyPromise((resolve, reject) => {
        setTimeout(() => {
          // resolve('success1')
          reject('error3')
        }, 1000);
      });

      MyPromise.any([promise1, promise2, promise3]).then((value) => {
        console.log('succ:', value);
      }, err => {
        console.dir(err);
        console.log('err:', err, err instanceof Error)
      })
    </script>
  </body>
</html>